package com.andertrift.controller;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
@RequestMapping(value="subscribe")
public class SubscribeController {
	
	@RequestMapping(method = RequestMethod.GET)
	public String subscribe(){
		return "subscribe";	
	}
	

	@RequestMapping(method = RequestMethod.POST)
	public String subscribePost(HttpServletRequest hr){
		HashMap<String, Object> parameters = (HashMap<String, Object>) hr.getParameterMap();
		if (!parameters.isEmpty()){
			if (parameters.containsKey("Beer")){
				System.out.println("beer selected");
			}
			if (parameters.containsKey("Wine")){
				System.out.println("wine selected");
			}
			if (parameters.containsKey("Food")){
				System.out.println("food selected");
			}
			if (parameters.containsKey("Facebook")){
				System.out.println("Facebook selected");
			}
			if (parameters.containsKey("Twitter")){
				System.out.println("Twitter selected");
			}
			if (parameters.containsKey("Linkedin")){
				System.out.println("Linkedin selected");
			}
		}
		return "hello";
	}
}
